﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Delphi.Mimir.Data.Entities.Final {
    public class ManagedProductPosition {
        public int ManagedProductPositionId { set; get; }
        public int ManagedProductId { set; get; }
        public virtual ManagedProduct ManagedProduct { set; get; }
        
        public virtual ICollection<Order> Orders { get {
                return ManagedProduct.Orders.Where(a => a.SymbolId == SymbolId).ToList<Order>();
            }
        }
        
        public virtual ICollection<OrderExecution> OrderExecutions { get {
                return ManagedProduct.Orders.Where(a => a.SymbolId == SymbolId).SelectMany(b => b.OrderExecutions).ToList<OrderExecution>();
            }
        }
        
        public int SymbolId { set; get; }
        public virtual Symbol Symbol { set; get; }
        public int Quantity { set; get; }
        public DateTime ValidFromDate { set; get; }
        public DateTime ValidUntilDate { set; get; }
    }
}
